﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HB.HttpServer.Fun
{
    internal class HtmlHelper
    {
        public enum Headings
        {
            H1, H2, H3, H4, H5, H6
        }
        public enum Aligns
        {
            Left, Center, Right
        }
        StringBuilder sb = null;
        public HtmlHelper()
        {
            sb = new StringBuilder();
            sb.AppendLine("<html>");
        }
        public void AddHeading(Headings head, string text, Aligns align)
        {
            sb.AppendLine($"<{head.ToString()} align={align.ToString()}>{text}</{head.ToString()}>");
        }
        public void AddParagraph(string text)
        {
            sb.AppendLine($"<p>{text}</p>");
        }
        public void AddNewLine()
        {
            sb.AppendLine("<br/>");
        }
        public void AddLink(string text, string link)
        {
            sb.AppendLine($"<a href='{link}'>{text}</a>");
        }
        public void AddLine()
        {
            sb.AppendLine("<hr></hr>");
        }
        public string Build()
        {
            sb.AppendLine("</html>");
            return sb.ToString();
        }
    }
}
